//
//  huiyuanDetailsViewController.m
//  daogouApp
//
//  Created by panquanReabam.com on 15-6-2.
//  Copyright (c) 2015年 jiezsoft.com. All rights reserved.
//

#import "BusinessSupplierEditSupplierViewController.h"
#import "HttpRequest.h"
#import "HAODEsingleton.h"
#import "ProductView.h"
#import "UIViewExt.h"
#import "RDVTabBarController.h"
#import "MJRefresh.h"
#import "huiyuanDetailsCell.h"
#import "HZAreaPickerView.h"
#import "ZJSwitch.h"
#import "daogouview.h"
#import "huiyuandengjiViewController.h"
#import "GenerateQRCodeViewController.h"
#import "SelectTag_NewViewController.h"
@interface BusinessSupplierEditSupplierViewController ()<MBProgressHUDDelegate,UIGestureRecognizerDelegate,UINavigationControllerDelegate,UITextFieldDelegate,UIScrollViewDelegate,UITextViewDelegate,HZAreaPickerDelegate>
@property (strong, nonatomic) NSString *areaValue;
@property (strong, nonatomic) NSString*cityValue;
@property (strong, nonatomic) HZAreaPickerView *locatePicker;
@property(nonatomic,retain)UIDatePicker* da;
@property (nonatomic,retain)NSString*jzdprovince;
@property (nonatomic,retain)NSString*jzdcity;
@property (nonatomic,retain)NSString*jzddistrict;
@property (nonatomic,retain)NSString*Sex;
@property (strong, nonatomic) NSString*GuideCode;
@property (strong, nonatomic) NSString*isActive;



-(void)cancelLocatePicker;

@end

@implementation BusinessSupplierEditSupplierViewController


{
    NSMutableArray* arrrs;
    BOOL saveAccount;
    UITextView* tv;
    UILabel * label;
    UIImageView*imagess;
    UISwitch *switchView;
    UIScrollView*myscrollView;
    HAODEsingleton* commdity;
    UIImageView* imageview;
    UILabel *lineLabel1;
    ProductView *clothView;
    NSMutableArray*Memo;
    NSMutableArray*Integral;
    NSMutableArray*Amount;
    NSMutableArray*CreateDate;
    UITextField*WeChatIdTextFied;
    UITextField*UserNameTextFied;
    UITextField*PhoneTextFied;
    UITextField*ProvinceNameTextFied;
    UITextField*AddressTextFied;
    UITextField*BirthDateTextFied;
    UITextField*isActiveTextFied;
    UIButton*isActiveBtn;
    NSMutableArray* arrr;
    NSMutableArray *selectFeatureCodeArray;
    UIButton*jiantouBtn;
    UIButton*daogouname;
    UIScrollView*mainScroll;
    daogouview*daogouView;
    NSMutableArray* arrrss;
    UIView*vi;
}
@synthesize alt = alt;
@synthesize areaValue=_areaValue, cityValue=_cityValue;
@synthesize locatePicker=_locatePicker;

-(void)setAreaValue:(NSString *)areaValue
{
    if (![_areaValue isEqualToString:areaValue]) {
        
        
        
        ProvinceNameTextFied.text = areaValue;
        
        
    }
}

-(void)setCityValue:(NSString *)cityValue
{
    if (![_cityValue isEqualToString:cityValue]) {
        //        _cityValue = [cityValue retain];
        ProvinceNameTextFied.text = cityValue;
    }
}

#pragma mark - HZAreaPicker delegate
-(void)pickerDidChaneStatus:(HZAreaPickerView *)picker
{
    if (picker.pickerStyle == HZAreaPickerWithStateAndCityAndDistrict) {
        self.areaValue = [NSString stringWithFormat:@"%@ %@ %@", picker.locate.state, picker.locate.city, picker.locate.district];
        
        
        
        self.jzdprovince= picker.locate.state;
        self.jzdcity=picker.locate.city;
        self.jzddistrict=picker.locate.district;
        
        
        
    } else{
        self.cityValue = [NSString stringWithFormat:@"%@ %@", picker.locate.state, picker.locate.city];
        
    }
}
-(void)area:(UIButton*)sender{
    
    
    [WeChatIdTextFied resignFirstResponder];
    [UserNameTextFied resignFirstResponder];
    [PhoneTextFied resignFirstResponder];
    [ProvinceNameTextFied resignFirstResponder];
    [BirthDateTextFied resignFirstResponder];
    [AddressTextFied resignFirstResponder];
    
    
    [self cancelLocatePicker];
    self.locatePicker = [[HZAreaPickerView alloc] initWithStyle:HZAreaPickerWithStateAndCityAndDistrict delegate:self] ;
    [self.locatePicker showInView:self.view];
    
    ProvinceNameTextFied.text=@"北京 通州";
    
    self.jzdprovince=@"北京";
    self.jzdcity=@"通州";
    
    
    
}

-(void)cancelLocatePicker
{
    [self.locatePicker cancelPicker];
    self.locatePicker.delegate = nil;
    self.locatePicker = nil;
}


#pragma mark - TextField delegate

- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
    [super touchesBegan:touches withEvent:event];
    [self cancelLocatePicker];
}
-(void)BackAction:(UIButton *)sender{
    
    [self.navigationController popViewControllerAnimated:YES];
}
- (void)viewDidDisappear:(BOOL)animated

{
    
    [super viewDidDisappear:animated];
    
    
    
    self.navigationController.delegate = nil;
    
}

-(void)viewWillAppear:(BOOL)animated{
    [super viewWillAppear:animated];
    [[self rdv_tabBarController] setTabBarHidden:YES];
    self.navigationController.navigationBarHidden=NO;
        self.navigationController.navigationBar.barStyle = UIBaselineAdjustmentNone;
    UILabel *lineLabel=[[UILabel alloc] initWithFrame:CGRectMake(0, 43,ScreenWidth, 1)];
    [lineLabel setBackgroundColor:[UIColor colorWithRed:238.0/255.0 green:238.0/255.0 blue:238.0/255.0 alpha:1.0]];
    [self.navigationController.navigationBar addSubview:lineLabel];
    [self.navigationController.navigationBar setTintColor:[UIColor whiteColor]];
    [[UINavigationBar appearance] setBarTintColor:Color];
    
       UIImage* backImage = [UIImage imageNamed:@"fanhui"];
    CGRect backframe = CGRectMake(0,0,30,30);
    UIButton* backButton= [[UIButton alloc] initWithFrame:backframe];
    [backButton setBackgroundImage:backImage forState:UIControlStateNormal];
    backButton.titleLabel.font=[UIFont systemFontOfSize:13];
    [backButton addTarget:self action:@selector(BackAction:) forControlEvents:UIControlEventTouchUpInside];
    UIBarButtonItem* leftBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:backButton];
    self.navigationItem.leftBarButtonItem = leftBarButtonItem;
    self.navigationController.delegate = self;
    
    self.navigationController.interactivePopGestureRecognizer.delegate = self;
    
    commdity=[HAODEsingleton shared];
    NSLog(@"=======%@",commdity.selectTagNameArray);
    if (commdity.selectTagCodeArray.count>0) {
        
        [vi removeFromSuperview];
        
        vi=[[UIView alloc]initWithFrame:CGRectMake(0, 700/2, ScreenWidth, 300)];
        
        [myscrollView addSubview:vi];
        for (int i = 0,j = 0; i < commdity.selectTagCodeArray.count; i++) {
            if (i % 4 == 0) {
                j++;
            }
            
            clothView = [[ProductView alloc]initWithFrame:CGRectMake(12.5+(ScreenWidth/4-5)*(i%4), (35*j), ScreenWidth/4-15, 26)];
            clothView.buttonView.titleLabel.textAlignment=NSTextAlignmentCenter;
            clothView.buttonView.titleLabel.font=[UIFont systemFontOfSize:conten14fot];
            [clothView.buttonView setTitle: [commdity.selectTagNameArray objectAtIndex:i]  forState:UIControlStateNormal];
            CGColorSpaceRef colorSpace2 = CGColorSpaceCreateDeviceRGB();
            CGColorRef colorref2 = CGColorCreate(colorSpace2,(CGFloat[]){209/255.0,170/255.0, 56/255.0, 1.0   });
            clothView.buttonView.backgroundColor=[UIColor colorWithRed:255/255.0 green:255/255.0 blue:234/255.0 alpha:1];
            [clothView.buttonView.layer setBorderColor:colorref2];//边框颜色
            
            [clothView.buttonView setTitleColor:huangtitleColor forState:0];
            [vi addSubview:clothView];
            
        }
        UIView*huiseview=[[UIView alloc]initWithFrame:CGRectMake(0,clothView.bottom+20, ScreenWidth, 10)];
        huiseview.backgroundColor=zuiqianhuicolor;
        huiseview.layer.borderWidth = 0.35;
        huiseview.layer.borderColor = qianhuicolor.CGColor;
        [vi addSubview:huiseview];

        tv=[[UITextView alloc]init];
        tv.frame=CGRectMake(10, huiseview.bottom+20, ScreenWidth-30, ScreenHeight*185/1334);
        tv.backgroundColor = [UIColor whiteColor];//设置它的背景颜色/Users/jiezsoft/Desktop/
        tv.scrollEnabled = YES;//是否可以拖动
        tv.delegate=self;
        //                tv.autoresizingMask = UIViewAutoresizingFlexibleHeight;//自适应高
        tv.font = [UIFont fontWithName:@"Arial" size:15.0];//设置字体名字和字体大小
        tv.layer.borderWidth =0;
        CGColorSpaceRef registedSpace11 = CGColorSpaceCreateDeviceRGB();
        CGColorRef tureBTncolorref111 = CGColorCreate(registedSpace11,(CGFloat[]){ 0, 0, 0, 0.3 });
        //                tv.keyboardType = UIKeyboardTypePhonePad;
        [tv.layer setBorderColor:tureBTncolorref111];//边框颜色
        tv.layer.cornerRadius =0;
        [vi addSubview:tv];
        
        
        
        imagess=[[UIImageView alloc]initWithFrame:CGRectMake(15, 8, 51/3, 43/3)];
        imagess.image=[UIImage imageNamed:@"_0000_xingxifankui.png"];
        [tv addSubview:imagess];
        label=[[UILabel alloc]init];
        label.frame =CGRectMake(38, 8, ScreenWidth-60, 15);
        label.text = @"备注";
        label.textColor=zuiqianhuicolor;
        label.numberOfLines=0;
        label.font=[UIFont systemFontOfSize:15];
        label.enabled = NO;//lable必须设置为不可用
        label.backgroundColor = [UIColor clearColor];
        [tv addSubview:label];
        
        UIView* myToolBar=[[UIView alloc]initWithFrame:CGRectMake(0, 0, ScreenWidth, viewheight)];
        myToolBar.backgroundColor=jianpancolor;
        UIButton*  tubtnDone=[[UIButton alloc]initWithFrame:CGRectMake(logoX,logoY, logoheight, logowidth)];
        [tubtnDone setImage:[UIImage imageNamed:@""] forState:UIControlStateNormal];
        [tubtnDone addTarget:self action:@selector(OnTapDone) forControlEvents:UIControlEventTouchUpInside];
        [myToolBar addSubview:tubtnDone];
        UIButton*btnDone111=[[UIButton alloc]initWithFrame:CGRectMake(myToolBar.frame.size.width - 55, 12, 40, 16)];
        [btnDone111 setTitle:@"确定" forState:UIControlStateNormal];
        [btnDone111 setTitleColor:jianpancolor1 forState:UIControlStateNormal];
        btnDone111 .titleLabel .font=[UIFont systemFontOfSize:daxiao];
        [btnDone111 addTarget:self action:@selector(OnTapDone) forControlEvents:UIControlEventTouchUpInside];
        [myToolBar addSubview:btnDone111];
        myToolBar.alpha=alp;
        UIButton* dabtn=[[UIButton alloc]initWithFrame:CGRectMake(myToolBar.frame.size.width-60, 0, 60, 40)];
        [dabtn addTarget:self action:@selector(OnTapDone) forControlEvents:UIControlEventTouchUpInside];
        [myToolBar addSubview:dabtn];
        
        
        tv.inputAccessoryView = myToolBar;
        
        
    }else{
        
        [vi removeFromSuperview];
        
        vi=[[UIView alloc]initWithFrame:CGRectMake(0, 700/2, ScreenWidth, 300)];
        
        [myscrollView addSubview:vi];
        
        
        clothView = [[ProductView alloc]initWithFrame:CGRectMake(12.5, (35), ScreenWidth/4-15, 26)];
        clothView.buttonView.titleLabel.textAlignment=NSTextAlignmentCenter;
        clothView.buttonView.titleLabel.font=[UIFont systemFontOfSize:conten14fot];
        [clothView.buttonView setTitle:@"无评论"  forState:UIControlStateNormal];
        CGColorSpaceRef colorSpace2 = CGColorSpaceCreateDeviceRGB();
        CGColorRef colorref2 = CGColorCreate(colorSpace2,(CGFloat[]){209/255.0,170/255.0, 56/255.0, 1.0   });
        clothView.buttonView.backgroundColor=[UIColor colorWithRed:255/255.0 green:255/255.0 blue:234/255.0 alpha:1];
        [clothView.buttonView.layer setBorderColor:colorref2];//边框颜色
        
        [clothView.buttonView setTitleColor:huangtitleColor forState:0];
        [vi addSubview:clothView];
        
        UIView*huiseview=[[UIView alloc]initWithFrame:CGRectMake(0,clothView.bottom+20, ScreenWidth, 10)];
        huiseview.backgroundColor=zuiqianhuicolor;
        huiseview.layer.borderWidth = 0.35;
        huiseview.layer.borderColor = qianhuicolor.CGColor;
        [vi addSubview:huiseview];

        
        tv=[[UITextView alloc]init];
        tv.frame=CGRectMake(10, huiseview.bottom+20, ScreenWidth-30, ScreenHeight*185/1334);
        tv.backgroundColor = [UIColor whiteColor];//设置它的背景颜色/Users/jiezsoft/Desktop/
        tv.scrollEnabled = YES;//是否可以拖动
        tv.delegate=self;
        //                tv.autoresizingMask = UIViewAutoresizingFlexibleHeight;//自适应高
        tv.font = [UIFont fontWithName:@"Arial" size:15.0];//设置字体名字和字体大小
        tv.layer.borderWidth =0;
        CGColorSpaceRef registedSpace11 = CGColorSpaceCreateDeviceRGB();
        CGColorRef tureBTncolorref111 = CGColorCreate(registedSpace11,(CGFloat[]){ 0, 0, 0, 0.3 });
        //                tv.keyboardType = UIKeyboardTypePhonePad;
        [tv.layer setBorderColor:tureBTncolorref111];//边框颜色
        tv.layer.cornerRadius =0;
        [vi addSubview:tv];
        
        
        
        imagess=[[UIImageView alloc]initWithFrame:CGRectMake(15, 8, 51/3, 43/3)];
        imagess.image=[UIImage imageNamed:@"_0000_xingxifankui.png"];
        [tv addSubview:imagess];
        label=[[UILabel alloc]init];
        label.frame =CGRectMake(38, 8, ScreenWidth-60, 15);
        label.text = @"备注";
        label.textColor=zuiqianhuicolor;
        label.numberOfLines=0;
        label.font=[UIFont systemFontOfSize:15];
        label.enabled = NO;//lable必须设置为不可用
        label.backgroundColor = [UIColor clearColor];
        [tv addSubview:label];
        
        UIView* myToolBar=[[UIView alloc]initWithFrame:CGRectMake(0, 0, ScreenWidth, viewheight)];
        myToolBar.backgroundColor=jianpancolor;
        UIButton*  tubtnDone=[[UIButton alloc]initWithFrame:CGRectMake(logoX,logoY, logoheight, logowidth)];
        [tubtnDone setImage:[UIImage imageNamed:@""] forState:UIControlStateNormal];
        [tubtnDone addTarget:self action:@selector(OnTapDone) forControlEvents:UIControlEventTouchUpInside];
        [myToolBar addSubview:tubtnDone];
        UIButton*btnDone111=[[UIButton alloc]initWithFrame:CGRectMake(myToolBar.frame.size.width - 55, 12, 40, 16)];
        [btnDone111 setTitle:@"确定" forState:UIControlStateNormal];
        [btnDone111 setTitleColor:jianpancolor1 forState:UIControlStateNormal];
        btnDone111 .titleLabel .font=[UIFont systemFontOfSize:daxiao];
        [btnDone111 addTarget:self action:@selector(OnTapDone) forControlEvents:UIControlEventTouchUpInside];
        [myToolBar addSubview:btnDone111];
        myToolBar.alpha=alp;
        UIButton* dabtn=[[UIButton alloc]initWithFrame:CGRectMake(myToolBar.frame.size.width-60, 0, 60, 40)];
        [dabtn addTarget:self action:@selector(OnTapDone) forControlEvents:UIControlEventTouchUpInside];
        [myToolBar addSubview:dabtn];
        
        
        tv.inputAccessoryView = myToolBar;
        
        
        
    }
    
    
    
    
    [myscrollView setContentSize:CGSizeMake(ScreenWidth, vi.bottom+100)];

}
- (void)viewDidLoad {
        [super viewDidLoad];
    
    
    selectFeatureCodeArray=[[NSMutableArray alloc]init];
    commdity=[HAODEsingleton shared];
    self.title = @"添加供应商";
    [self.navigationController.navigationBar setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:
                                                                     backColor,
                                                                     UITextAttributeTextColor,
                                                                     [UIColor colorWithRed:0.0 green:0.0 blue:0.0 alpha:1],
                                                                     UITextAttributeTextShadowColor,
                                                                     [NSValue valueWithUIOffset:UIOffsetMake(0, 0)],
                                                                     UITextAttributeTextShadowOffset,
                                                                     [UIFont fontWithName:@"Helvetica Neue" size:tetlefot],
                                                                     UITextAttributeFont,nil]];
    
    
    
    
    
    
    
    
    UIButton*editor = [[UIButton alloc] initWithFrame:CGRectMake(30, 0.0, ScreenWidth*70/750, ScreenWidth*60/750)];
    [editor setTitle:@"保存" forState:UIControlStateNormal];
    editor .titleLabel.font=[UIFont systemFontOfSize:16];
    [editor setTitleColor:luseColor forState:UIControlStateNormal];
    [editor addTarget:self action:@selector(editor:) forControlEvents:UIControlEventTouchUpInside];
    UIBarButtonItem* myBtnBtn = [[UIBarButtonItem alloc] initWithCustomView:editor];
    self.navigationItem.rightBarButtonItem = myBtnBtn;
    
    
    _da = [[UIDatePicker alloc] init];
    [_da addTarget:self action:@selector(dateChanged:) forControlEvents:UIControlEventValueChanged];
    _da.datePickerMode = UIDatePickerModeDate;
    
    
    myscrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(0,0, ScreenWidth, ScreenHeight)];
    [myscrollView setBackgroundColor: [UIColor colorWithRed:255.0/255.0 green:255.0/255.0 blue:255.0/255.0 alpha:1.0]];
    
    myscrollView.delegate = self;
    myscrollView.userInteractionEnabled = YES;
    myscrollView.scrollEnabled = YES;
    myscrollView.showsVerticalScrollIndicator = FALSE;
    myscrollView.showsHorizontalScrollIndicator = FALSE;
    
    // 手势
    UITapGestureRecognizer *singleFingerOne = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(closeKeyBoad)];
    singleFingerOne.numberOfTouchesRequired = 1; //手指数
    singleFingerOne.numberOfTapsRequired = 1; //tap次数
    singleFingerOne.delegate = self;
    [myscrollView addGestureRecognizer:singleFingerOne];
    
    
    
    
    UIView*view1=[[UIView alloc]initWithFrame:CGRectMake(0, 0, ScreenWidth, 88/2)];
    view1.backgroundColor=[UIColor whiteColor];
    [myscrollView addSubview:view1];
    UILabel* duogou=[[UILabel alloc]initWithFrame:CGRectMake(20, 0, 40, 88/2)];
    duogou.text=[NSString stringWithFormat:@"员工"];
    duogou.textColor=zhonghuiColor;
    duogou.font=[UIFont systemFontOfSize:conten14fot];
    [myscrollView addSubview:duogou];
    
    NSUserDefaults *user1 = [NSUserDefaults standardUserDefaults];
    NSString* userName = [user1 objectForKey:@"userName"];
    self.GuideCode = [user1 objectForKey:@"UserCode"];
    
    daogouname=[[UIButton alloc]initWithFrame:CGRectMake(ScreenWidth-200,  0,180,88/2)];
    [daogouname setTitle:userName forState:UIControlStateNormal];
    daogouname.titleLabel.font=[UIFont systemFontOfSize:conten14fot];
    daogouname.titleLabel.textAlignment=NSTextAlignmentLeft;
    daogouname.contentHorizontalAlignment = UIControlContentHorizontalAlignmentRight;
    //[daogouname addTarget:self action:@selector(xuanzhidaogou:) forControlEvents:UIControlEventTouchUpInside];
    [daogouname setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
    
    [view1 addSubview:daogouname];
    
    UIView*huiseview=[[UIView alloc]initWithFrame:CGRectMake(0,44, ScreenWidth, 10)];
    huiseview.backgroundColor=zuiqianhuicolor;
    huiseview.layer.borderWidth = 0.35;
    huiseview.layer.borderColor = qianhuicolor.CGColor;
    [myscrollView addSubview:huiseview];

    
    
    
    
    UILabel* WeChatId=[[UILabel alloc]initWithFrame:CGRectMake(20,  88/2+10, 90,88/2)];
    WeChatId.text=[NSString stringWithFormat:@"%@", @"名称"];
    WeChatId.font=[UIFont systemFontOfSize:conten14fot];
    WeChatId.textColor=[UIColor blackColor];
    [myscrollView addSubview:WeChatId];
    
        WeChatIdTextFied=[[UITextField alloc]initWithFrame:CGRectMake(WeChatId.right-15,  88/2+10, ScreenWidth*450/750, 88/2)];
        WeChatIdTextFied.borderStyle = UITextBorderStyleNone;
        WeChatIdTextFied.font = [UIFont systemFontOfSize: conten14fot];
        WeChatIdTextFied.textColor=[UIColor blackColor];
        WeChatIdTextFied.autocapitalizationType = UITextAutocapitalizationTypeSentences;
        WeChatIdTextFied.tag=1;
        WeChatIdTextFied.placeholder = @"请输入名称"; //默认显示的字
//       WeChatIdTextFied.text=commdity.
        [WeChatIdTextFied setUserInteractionEnabled:YES];
        WeChatIdTextFied.clearButtonMode = UITextFieldViewModeWhileEditing;
        [myscrollView addSubview:WeChatIdTextFied];
    
    UILabel* UserName1=[[UILabel alloc]initWithFrame:CGRectMake(20,  175/2+10, 90,88/2)];
    UserName1.text=[NSString stringWithFormat:@"%@", @"联系人"];
    UserName1.font=[UIFont systemFontOfSize:conten14fot];
    UserName1.textColor=[UIColor blackColor];
    [myscrollView addSubview:UserName1];
    UserNameTextFied=[[UITextField alloc]initWithFrame:CGRectMake(WeChatId.right-15,   175/2+10, ScreenWidth*450/750,  88/2)];
    UserNameTextFied.borderStyle = UITextBorderStyleNone;
    UserNameTextFied.font = [UIFont systemFontOfSize: conten14fot];
    UserNameTextFied.textColor=[UIColor blackColor];
    UserNameTextFied.autocapitalizationType = UITextAutocapitalizationTypeSentences;
    UserNameTextFied.tag=2;
    UserNameTextFied.placeholder = @"请输入联系人姓名"; //默认显示的字
    UserNameTextFied.delegate = self;
    [UserNameTextFied setUserInteractionEnabled:YES];
    UserNameTextFied.clearButtonMode = UITextFieldViewModeWhileEditing;
    [myscrollView addSubview:UserNameTextFied];
    
    
    ZJSwitch *switch2 = [[ZJSwitch alloc] initWithFrame:CGRectMake(ScreenWidth-75,  185/2+10, 55, ScreenHeight*15/1334)];
    switch2.onText = @"男";
    switch2.offText = @"女";
    if (![commdity. Sex isEqual:[NSNull null]]) {
        
        if ([commdity.Sex isEqualToString:@"1"]) {
            switch2.on = YES;
            NSLog(@"男");
            switch2.backgroundColor = [UIColor clearColor];
            switch2.onTintColor = [UIColor colorWithRed:53/255.0 green:159/255.0 blue:234/255.0 alpha:1];

            switch2.tintColor = [UIColor colorWithRed:253.00/255.0 green:129.00/255.0 blue:182.00/255.0 alpha:1];
            
            self.Sex= @"男";
            
        }else {
            NSLog(@"女");
            switch2.on = NO;
            switch2.backgroundColor = [UIColor clearColor];
            switch2.onTintColor = [UIColor colorWithRed:53/255.0 green:159/255.0 blue:234/255.0 alpha:1];
            switch2.tintColor = [UIColor colorWithRed:253.00/255.0 green:129.00/255.0 blue:182.00/255.0 alpha:1];
            
            self.Sex= @"女";
        }
    }else {
        
        NSLog(@"女");
        switch2.on = NO;
        switch2.backgroundColor = [UIColor clearColor];
        switch2.onTintColor = [UIColor colorWithRed:53/255.0 green:159/255.0 blue:234/255.0 alpha:1];

        switch2.tintColor = [UIColor colorWithRed:253.00/255.0 green:129.00/255.0 blue:182.00/255.0 alpha:1];
        
        self.Sex= @"女";
        
        
        
    }
    
    
    
    
    
    
    
    
    [switch2 addTarget:self action:@selector(switchAction1:) forControlEvents:UIControlEventValueChanged];
    [myscrollView addSubview:switch2];
    UILabel* Phone=[[UILabel alloc]initWithFrame:CGRectMake(20, 255/2+10, 90,88/2)];
    Phone.text=[NSString stringWithFormat:@"%@", @"联系电话"];
    Phone.font=[UIFont systemFontOfSize:conten14fot];
    Phone.textColor=[UIColor blackColor];
    [myscrollView addSubview:Phone];
    PhoneTextFied=[[UITextField alloc]initWithFrame:CGRectMake(WeChatId.right-15,  255/2+10, ScreenWidth*450/750,  88/2)];
    PhoneTextFied.borderStyle = UITextBorderStyleNone;
    PhoneTextFied.keyboardType = UIKeyboardTypeNumberPad;
    PhoneTextFied.font = [UIFont systemFontOfSize: conten14fot];
    PhoneTextFied.textColor=[UIColor blackColor];
    PhoneTextFied.autocapitalizationType = UITextAutocapitalizationTypeSentences;
    PhoneTextFied.tag=3;
    PhoneTextFied.placeholder = @"请输入联系人手机号码"; //默认显示的字
    //  WeChatIdTextFied.text=commdity.Company;
    PhoneTextFied.delegate = self;
    [PhoneTextFied addTarget:self action:@selector(userNumberLimitTextLength:) forControlEvents:UIControlEventEditingChanged];
    [PhoneTextFied setUserInteractionEnabled:YES];
    PhoneTextFied.clearButtonMode = UITextFieldViewModeWhileEditing;
    [myscrollView addSubview:PhoneTextFied];
    UILabel* ProvinceName=[[UILabel alloc]initWithFrame:CGRectMake(20, 340/2+10,90,88/2)];
    ProvinceName.text=[NSString stringWithFormat:@"%@", @"地区"];
    ProvinceName.font=[UIFont systemFontOfSize:conten14fot];
    ProvinceName.textColor=[UIColor blackColor];
    [myscrollView addSubview:ProvinceName];
    UIButton*area=[[UIButton alloc]initWithFrame:CGRectMake(ProvinceName.right-15, 340/2+10, ScreenWidth, 88/2)];
    [area addTarget:self action:@selector(area:) forControlEvents:UIControlEventTouchUpInside];
    [myscrollView addSubview:area];
    UIButton*jiantouBtn3 = [[UIButton alloc]init];
    jiantouBtn3.frame = CGRectMake(ScreenWidth-30,375/2+10,8, 13);
    [jiantouBtn3 setImage:[UIImage imageNamed:@"xiangzuo-.png"] forState:UIControlStateNormal];
    [myscrollView addSubview:jiantouBtn3];
    
    ProvinceNameTextFied=[[UITextField alloc]initWithFrame:CGRectMake(WeChatId.right-15,  340/2+10, ScreenWidth*450/750, 88/2)];
    ProvinceNameTextFied.borderStyle = UITextBorderStyleNone;
    ProvinceNameTextFied.font = [UIFont systemFontOfSize: conten14fot];
    ProvinceNameTextFied.textColor=[UIColor blackColor];
    ProvinceNameTextFied.autocapitalizationType = UITextAutocapitalizationTypeSentences;
    ProvinceNameTextFied.tag=4;
    ProvinceNameTextFied.placeholder = @"请选择地区"; //默认显示的字
    //  ProvinceNameTextFied.text=commdity.Company;
    [ProvinceNameTextFied setUserInteractionEnabled:NO];
    ProvinceNameTextFied.clearButtonMode = UITextFieldViewModeWhileEditing;
    [myscrollView addSubview:ProvinceNameTextFied];
    
    
    
    UILabel* Address=[[UILabel alloc]initWithFrame:CGRectMake(20, 430/2+10, ScreenWidth*170/750,88/2)];
    Address.text=[NSString stringWithFormat:@"%@", @"详细地址"];
    Address.font=[UIFont systemFontOfSize:conten14fot];
    Address.textColor=[UIColor blackColor];
    [myscrollView addSubview:Address];
    AddressTextFied=[[UITextField alloc]initWithFrame:CGRectMake(WeChatId.right-15, 430/2+10, ScreenWidth*500/750,  88/2)];
    AddressTextFied.borderStyle = UITextBorderStyleNone;
    AddressTextFied.font = [UIFont systemFontOfSize: conten14fot];
    AddressTextFied.textColor=[UIColor blackColor];
    AddressTextFied.autocapitalizationType = UITextAutocapitalizationTypeSentences;
    AddressTextFied.tag=5;
    AddressTextFied.placeholder = @"请输入详细地址"; //默认显示的字
    //  WeChatIdTextFied.text=commdity.Company;
    [AddressTextFied setUserInteractionEnabled:YES];
    AddressTextFied.delegate = self;
    AddressTextFied.clearButtonMode = UITextFieldViewModeWhileEditing;
    [myscrollView addSubview:AddressTextFied];
    
    
    
    
    UILabel* isActive=[[UILabel alloc]initWithFrame:CGRectMake(20, 520/2+10, ScreenWidth*170/750,88/2)];
    isActive.text=[NSString stringWithFormat:@"%@", @"状态"];
    isActive.font=[UIFont systemFontOfSize:conten14fot];
    isActive.textColor=[UIColor blackColor];
    [myscrollView addSubview:isActive];
     self.isActive=@"1";
    
    isActiveBtn=[[UIButton alloc]initWithFrame:CGRectMake(50,  520/2+10, ScreenWidth-100,175/2/2)];
    isActiveBtn.titleLabel.font=[UIFont systemFontOfSize:conten14fot];
    [isActiveBtn setTitle:@"可用" forState:UIControlStateNormal];
    isActiveBtn.contentHorizontalAlignment=UIControlContentHorizontalAlignmentRight;
    [isActiveBtn addTarget:self action:@selector(isActiveBtn:) forControlEvents:UIControlEventTouchUpInside];
    [isActiveBtn setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
    [myscrollView addSubview:isActiveBtn];
    
    UIButton*jiantouBtn12 = [[UIButton alloc] initWithFrame:CGRectMake(ScreenWidth-40,520/2+7.5+10,30, 30)];
    [jiantouBtn12 setImage:[UIImage imageNamed:@"zhankai"] forState:UIControlStateNormal];
    [jiantouBtn12 addTarget:self action:@selector(isActiveBtn:) forControlEvents:UIControlEventTouchUpInside];
    [myscrollView addSubview:jiantouBtn12];
    
    
    UILabel* BirthDate1=[[UILabel alloc]initWithFrame:CGRectMake(20, 620/2+10, ScreenWidth*70/750,44)];
    BirthDate1.text=[NSString stringWithFormat:@"%@", @"标签"];
    BirthDate1.font=[UIFont systemFontOfSize:conten14fot];
    BirthDate1.textColor=[UIColor blackColor];
    [myscrollView addSubview:BirthDate1];
    
    UILabel* BirthDate=[[UILabel alloc]initWithFrame:CGRectMake(BirthDate1.right, 620/2+10, 170,44)];
    BirthDate.text=[NSString stringWithFormat:@"%@", @"(可以多选)"];
    BirthDate.font=[UIFont systemFontOfSize:conten14fot];
    BirthDate.textColor=qianhuicolor;
    [myscrollView addSubview:BirthDate];
    UIButton*biaoqiangBtn=[[UIButton alloc]initWithFrame:CGRectMake(ProvinceName.right-15, 620/2+10, ScreenWidth, 88/2)];
    [biaoqiangBtn addTarget:self action:@selector(biaoqiangBtn:) forControlEvents:UIControlEventTouchUpInside];
    [myscrollView addSubview:biaoqiangBtn];
    UIButton*jiantou = [[UIButton alloc]init];
    jiantou.frame = CGRectMake(ScreenWidth-30,655/2+10,8, 13);
    [jiantou setImage:[UIImage imageNamed:@"xiangzuo-.png"] forState:UIControlStateNormal];
    [myscrollView addSubview:jiantou];

    
    UILabel *line1 = [[UILabel alloc]initWithFrame:CGRectMake(15,175/2+10, ScreenWidth-30, 0.35)];
    line1.backgroundColor = labelColor;
    [myscrollView addSubview:line1];
    UILabel *line11 = [[UILabel alloc]initWithFrame:CGRectMake(15,255/2+10, ScreenWidth-30, 0.35)];
    line11.backgroundColor = labelColor;
    [myscrollView addSubview:line11];
    UILabel *line111 = [[UILabel alloc]initWithFrame:CGRectMake(15,340/2+10, ScreenWidth-30, 0.35)];
    line111.backgroundColor = labelColor;
    [myscrollView addSubview:line111];
    UILabel *line1111 = [[UILabel alloc]initWithFrame:CGRectMake(15,430/2+10, ScreenWidth-30, 0.35)];
    line1111.backgroundColor = labelColor;
    [myscrollView addSubview:line1111];
    UILabel *line12 = [[UILabel alloc]initWithFrame:CGRectMake(15,520/2+10, ScreenWidth-30, 0.35)];
    line12.backgroundColor = labelColor;
    [myscrollView addSubview:line12];
    UILabel *line121 = [[UILabel alloc]initWithFrame:CGRectMake(15,610/2+10, ScreenWidth-30, 0.35)];
    line121.backgroundColor = labelColor;
    [myscrollView addSubview:line121];
    

    
    UIImageView *_xianview = [[UIImageView alloc]initWithFrame:CGRectMake(15,700/2+10, ScreenWidth-30, 0.5)];
    _xianview.image=[UIImage imageNamed:@"hengxian"];
    [myscrollView addSubview:_xianview];

    vi=[[UIView alloc]initWithFrame:CGRectMake(0, 700/2+10, ScreenWidth, 300)];
    
    [myscrollView addSubview:vi];
    
    
    
    
    tv=[[UITextView alloc]init];
    tv.frame=CGRectMake(10, 30, ScreenWidth-30, ScreenHeight*185/1334);
    tv.backgroundColor = [UIColor whiteColor];//设置它的背景颜色/Users/jiezsoft/Desktop/
    tv.scrollEnabled = YES;//是否可以拖动
    tv.delegate=self;
    //                tv.autoresizingMask = UIViewAutoresizingFlexibleHeight;//自适应高
    tv.font = [UIFont fontWithName:@"Arial" size:15.0];//设置字体名字和字体大小
    tv.layer.borderWidth =0;
    CGColorSpaceRef registedSpace11 = CGColorSpaceCreateDeviceRGB();
    CGColorRef tureBTncolorref111 = CGColorCreate(registedSpace11,(CGFloat[]){ 0, 0, 0, 0.3 });
    //                tv.keyboardType = UIKeyboardTypePhonePad;
    [tv.layer setBorderColor:tureBTncolorref111];//边框颜色
    tv.layer.cornerRadius =0;
    [vi addSubview:tv];
    
    
    
    imagess=[[UIImageView alloc]initWithFrame:CGRectMake(15, 8, 51/3, 43/3)];
    imagess.image=[UIImage imageNamed:@"_0000_xingxifankui.png"];
    [tv addSubview:imagess];
    label=[[UILabel alloc]init];
    label.frame =CGRectMake(38, 8, ScreenWidth-60, 15);
    label.text = @"备注";
    label.textColor=zuiqianhuicolor;
    label.numberOfLines=0;
    label.font=[UIFont systemFontOfSize:15];
    label.enabled = NO;//lable必须设置为不可用
    label.backgroundColor = [UIColor clearColor];
    [tv addSubview:label];
    
    UIView* myToolBar=[[UIView alloc]initWithFrame:CGRectMake(0, 0, ScreenWidth, viewheight)];
    myToolBar.backgroundColor=jianpancolor;
    UIButton*  tubtnDone=[[UIButton alloc]initWithFrame:CGRectMake(logoX,logoY, logoheight, logowidth)];
    [tubtnDone setImage:[UIImage imageNamed:@""] forState:UIControlStateNormal];
    [tubtnDone addTarget:self action:@selector(OnTapDone) forControlEvents:UIControlEventTouchUpInside];
    [myToolBar addSubview:tubtnDone];
    UIButton*btnDone111=[[UIButton alloc]initWithFrame:CGRectMake(myToolBar.frame.size.width - 55, 12, 40, 16)];
    [btnDone111 setTitle:@"确定" forState:UIControlStateNormal];
    [btnDone111 setTitleColor:jianpancolor1 forState:UIControlStateNormal];
    btnDone111 .titleLabel .font=[UIFont systemFontOfSize:daxiao];
    [btnDone111 addTarget:self action:@selector(OnTapDone) forControlEvents:UIControlEventTouchUpInside];
    [myToolBar addSubview:btnDone111];
    myToolBar.alpha=alp;
    UIButton* dabtn=[[UIButton alloc]initWithFrame:CGRectMake(myToolBar.frame.size.width-60, 0, 60, 40)];
    [dabtn addTarget:self action:@selector(OnTapDone) forControlEvents:UIControlEventTouchUpInside];
    [myToolBar addSubview:dabtn];
    
    AddressTextFied.inputAccessoryView = myToolBar;
    PhoneTextFied.inputAccessoryView = myToolBar;
    UserNameTextFied.inputAccessoryView = myToolBar;
    tv.inputAccessoryView = myToolBar;
    WeChatIdTextFied.inputAccessoryView = myToolBar;
  
    [myscrollView setContentSize:CGSizeMake(ScreenWidth, vi.bottom+100)];
 
    [self.view addSubview:myscrollView];
    
}
-(void)biaoqiangBtn:(UIButton*)sender{
    //修改会员已有标签（//添加会员时候已有标签会清空掉）
    
    //    commdity.selectTagCodeArray
    //    commdity.selectTagNameArray
    
    SelectTag_NewViewController *detailViewController = [[SelectTag_NewViewController alloc] init];
    detailViewController.optionNameString=@"SupplierTag";
    detailViewController.selectedTagCodeArray=commdity.selectTagCodeArray;
    [self.navigationController pushViewController:detailViewController animated:YES];
    
    
}


- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex{
    
    if (buttonIndex == 1) {
        
        
        [isActiveBtn setTitle:@"不可用" forState:UIControlStateNormal];
        self.isActive=@"0";
        
        
    }
    if (buttonIndex == 0) {
        [isActiveBtn setTitle:@"可用" forState:UIControlStateNormal];
        self.isActive=@"1";
        
}
    
    
}

-(void)isActiveBtn:(UIButton*)sender{
    
    
  
        
        
        UIAlertView*alt1 = [[UIAlertView alloc] initWithTitle:@"请选择状态" message:nil delegate:self cancelButtonTitle:@"可用" otherButtonTitles:@"不可用", nil];
        [alt1 show];
    }

-(void)xuanzhidaogou:(UIButton*)sender{
    [mainScroll removeFromSuperview];
    
    NSUserDefaults *user = [NSUserDefaults standardUserDefaults];
    NSString* Token = [user objectForKey:@"Token"];
    if (Token ==nil) {
        Token=@"dd";
    }
    NSMutableDictionary *param = [NSMutableDictionary new];
    [param setValue:Token forKey:@"Token"];
    
    mainScroll = [[UIScrollView alloc]initWithFrame:CGRectMake(0, 64+ScreenHeight*75/1334, ScreenWidth, ScreenHeight)];
    mainScroll.delegate = self;
    mainScroll.userInteractionEnabled = YES;
    mainScroll.scrollEnabled = YES;
    mainScroll.backgroundColor=[UIColor whiteColor];
    mainScroll.alpha=0.89;
    [self.view addSubview:mainScroll];
    
    [Global showIndeterminateHudSub:@"加载中，请稍后。。。" delay:30 view:self.view];
    
    
    [HttpRequest requestData:@"Guide/GuideList" params:param success:^(BOOL isSuccess, SeverData *severDataDict) {
        if (isSuccess) {
            if ([[severDataDict.dataDict objectForKey:@"ResultInt"] integerValue]==0) {
                [Global hideProgressHUDInternal:self.view];
                NSString *requestResultStr=[severDataDict.dataDict objectForKey:@"ResultString"];
                // [Global showTextHud:requestResultStr view:self.view];
                [Global showTextHudSub:requestResultStr view:self.view];
                arrrss=[[NSMutableArray alloc]init];
                
                arrrss=[severDataDict.dataDict objectForKey:@"DataLine"];
                
                NSLog(@"%@",arrrss);
                if (arrrss.count>0) {
                    
                    for (int i = 0; i<arrrss.count; i++) {
                        
                        daogouView = [[daogouview alloc]initWithFrame:CGRectMake(0, 0+(50*i), ScreenWidth, 50)];
                        
                        daogouView.buttonView.titleLabel.textAlignment=NSTextAlignmentCenter;
                        daogouView.buttonView.titleLabel.font=[UIFont systemFontOfSize:conten14fot];
                        
                        [daogouView.buttonView setTitle: [[arrrss objectAtIndex:i] objectForKey:@"content"] forState:UIControlStateNormal];
                        daogouView.buttonView.backgroundColor=[UIColor whiteColor];
                        daogouView.buttonView.tag=i;
                        [daogouView.buttonView setTitleColor:[UIColor clearColor] forState:UIControlStateNormal];
                        [daogouView.buttonView setTitleColor:shenhuicolor forState:0];
                        [daogouView.buttonView addTarget:self action:@selector(daogouView:) forControlEvents:UIControlEventTouchUpInside];
                        
                        [mainScroll addSubview:daogouView];
                    }
                    
                    
                    [mainScroll setContentSize:CGSizeMake(ScreenWidth, daogouView.bottom)];
                }
                
                
                
                
                
            }else{
                [Global hideProgressHUDInternal:self.view];
                NSString *requestResultStr=[severDataDict.dataDict objectForKey:@"ResultString"];
                [Global showTextHudSub:requestResultStr view:self.view];
            }
            
        }
        else
        {
            [Global hideProgressHUDInternal:self.view];
            NSLog(@"aaaaaaaa%@",severDataDict.dataDict);
            [Global showTextHudSub:@"连接失败" view:self.view];
        }
        
    }];
    
    
    
    
    
    
    
    
    
    
    
    
}



-(void)gong:(UIButton *)sender{
    
    
    
    
    
}
-(void)daogouView:(UIButton *)sender{
    
    self.GuideCode=[[arrrss objectAtIndex:sender.tag]objectForKey:@"code"];
    NSLog(@"%@",self.GuideCode);
    
    [mainScroll removeFromSuperview];
    
    [daogouname setTitle:sender.titleLabel.text forState:UIControlStateNormal];
}


#pragma mark - Table view delegate
- (void)scrollViewWillBeginDecelerating:(UIScrollView *)scrollView{
    
    //     bugview.frame=CGRectMake(0, ScreenHeight, ScreenWidth, 50);
    
    //    if (lastContentOffset < scrollView.contentOffset.y) {
    //
    //        [[self rdv_tabBarController] setTabBarHidden:!self.rdv_tabBarController.tabBarHidden animated:NO];
    //
    //    }else{
    //
    //        [[self rdv_tabBarController] setTabBarHidden:!self.rdv_tabBarController.tabBarHidden animated:YES];
    //
    //    }
}
-(void)switchAction1:(UISwitch*)sender{
    
    if (sender.on ==YES) {
        
        self.Sex=nil;
        self.Sex=@"男";
        NSLog(@"%@",self.Sex);
        
    }
    
    if (sender.on == NO) {
        self.Sex=nil;
        self.Sex=@"女";
        
        
        NSLog(@"%@",self.Sex);
        
    }
}
//账号长度限制
- (void)userNumberLimitTextLength:(UITextField*)textField
{
    if ([textField.text length] > 11)
    {
        textField.text = [textField.text substringToIndex:11];
    }
}

-(void)ItemCodebut:(UIButton*)sender{
    
    saveAccount=! saveAccount;
    
    NSLog(@"选择%ld",sender.tag);
    
    
    if (!saveAccount) {
        if (selectFeatureCodeArray.count>0) {
            [sender setTitleColor:zhonghuiColor forState:0];
            CGColorSpaceRef colorSpace2 = CGColorSpaceCreateDeviceRGB();
            CGColorRef colorref2 = CGColorCreate(colorSpace2,(CGFloat[]){153/255.0,153/255.0, 153/255.0, 1.0   });
            sender.backgroundColor=[UIColor whiteColor];
            [sender.layer setBorderColor:colorref2];//边框颜色
            for (int i=0; i<selectFeatureCodeArray.count; i++) {
                
                NSString *codeStr = [selectFeatureCodeArray objectAtIndex:i];
                if ([codeStr isEqualToString:[[arrrs objectAtIndex:sender.tag-1]objectForKey:@"code"]] ) {
                    [selectFeatureCodeArray removeObjectAtIndex:i];//从指定索引移除
                }
            }NSLog(@"取消%ld",sender.tag);
            NSLog(@"---------%@",selectFeatureCodeArray);
        }
        
    }
    else
    {
        
        
        [sender setTitleColor:huangtitleColor forState:0];
        CGColorSpaceRef colorSpace2 = CGColorSpaceCreateDeviceRGB();
        CGColorRef colorref2 = CGColorCreate(colorSpace2,(CGFloat[]){209/255.0,170/255.0, 56/255.0, 1.0   });
        sender.backgroundColor=[UIColor colorWithRed:255/255.0 green:255/255.0 blue:234/255.0 alpha:1];
        [sender.layer setBorderColor:colorref2];//边框颜色
        
        [selectFeatureCodeArray addObject:[[arrrs objectAtIndex:sender.tag-1]objectForKey:@"code"]];
        NSLog(@"FeatureCode---------%@",[[arrrs objectAtIndex:sender.tag-1]objectForKey:@"code"]);
        NSLog(@"选择%ld",sender.tag);
        NSLog(@"---------%@",selectFeatureCodeArray);
        
        
    }
    
    
    
}
-(void)editor:(UIButton*)sender{
    
    
    
    if ([ WeChatIdTextFied.text length] < 1)
    {
        [self showAlertMessage:@"请输入供应商名称"];
    }
    else
    {
        
    if ([ UserNameTextFied.text length] < 1)
    {
        [self showAlertMessage:@"请输入联系人姓名"];
    }
    else
    {
        
        if ([PhoneTextFied.text length] <1)
        {
            [self showAlertMessage:@"请输入联系人手机号码"];
        }
        else{
            
            
            
            
            NSUserDefaults *user = [NSUserDefaults standardUserDefaults];
            NSString* Token = [user objectForKey:@"tokenId"];
            NSMutableDictionary *params = [NSMutableDictionary new];
            
            [params setValue:Token forKey:@"tokenId"];
             [params setValue:@"A" forKey:@"editType"];
            
            [params setValue:UserNameTextFied.text forKey:@"linkMan"];
            [params setValue:WeChatIdTextFied.text forKey:@"supName"];
            
            [params setValue:self.jzdprovince forKey:@"provinceName"];
            [params setValue:self.jzdcity forKey:@"cityName"];
            [params setValue:self.jzddistrict forKey:@"regionName"];
            
            [params setValue:self.isActive forKey:@"isActive"];
            [params setValue:AddressTextFied.text  forKey:@"address"];
            [params setValue:PhoneTextFied.text forKey:@"phone"];
            
            NSMutableArray *mDocumentLine=[NSMutableArray array];
            
            
            
            for (int i=0; i<commdity.selectTagCodeArray.count; i++) {
                
                NSMutableDictionary *dic = [NSMutableDictionary dictionary];
                NSString *codeStr = [commdity.selectTagCodeArray objectAtIndex:i];
                [dic setValue:codeStr forKey:@"code"];
                [mDocumentLine addObject:dic];
                
                
            }

            
            NSLog(@"====%@",mDocumentLine);
            [params setValue:mDocumentLine  forKey:@"tags"];
            [params setValue:self.Sex forKey:@"sex"];
            [params setValue:tv.text forKey:@"remark"];
            
               NSLog(@"====%@",params);
            [Global showIndeterminateHudSub:@"加载中，请稍后。。。" delay:30 view:self.view];
            
            
            [HttpRequest requestData:@"Business/Supplier/EditSupplier" params:params success:^(BOOL isSuccess, SeverData *severDataDict) {
                if (isSuccess) {
                    
                    NSLog(@"33333333====%@",severDataDict.dataDict);
                    if ([[severDataDict.dataDict objectForKey:@"ResultInt"] integerValue]==0) {
                        [Global hideProgressHUDInternal:self.view];
                        NSString *requestResultStr=[severDataDict.dataDict objectForKey:@"ResultString"];
                        [Global showTextHudSub:requestResultStr view:self.view];
//                        commdity.WeChatId=@"";
//                        
//                        
//                        commdity.memberId=[severDataDict.dataDict objectForKey:@"memberId"];
//                        
//                        
//                        
//                        commdity.adress=AddressTextFied.text;
//                        commdity.Sex=self.Sex;
//                        commdity.Phone=PhoneTextFied.text;
//                        commdity.userName=UserNameTextFied.text;
                        [self.navigationController popViewControllerAnimated:YES];
                        
                        
                        
                        
                        
                        
                        
                        
                    }else{
                        [Global hideProgressHUDInternal:self.view];
                        NSString *requestResultStr=[severDataDict.dataDict objectForKey:@"ResultString"];
                        [Global showTextHudSub:requestResultStr view:self.view];
                    }
                    
                }
                else
                {
                    [Global hideProgressHUDInternal:self.view];
                    
                    [Global showTextHudSub:@"连接失败" view:self.view];
                }
                
            }];
            
            
        }
        }
    }
    
    
    
}
- (NSData *)toJSONData:(id)theData{
    
    NSError *error = nil;
    NSData *jsonData = [NSJSONSerialization dataWithJSONObject:theData
                                                       options:NSJSONWritingPrettyPrinted
                                                         error:&error];
    
    if ([jsonData length] > 0 && error == nil){
        return jsonData;
    }else{
        return nil;
    }
}
-(void)textViewDidChange:(UITextView *)textView
{
    //        self.examineText =  textView.text;
    if (textView.text.length == 0) {
        [imagess removeFromSuperview];
        
        imagess=[[UIImageView alloc]initWithFrame:CGRectMake(15, 8, 51/3, 51/3)];
        imagess.image=[UIImage imageNamed:@"_0000_xingxifankui.png"];
        [tv addSubview:imagess];
        label.text = @"备注";
        
    }else{
        [imagess removeFromSuperview];
        label.text = @"";
    }
}



- (void)dateChanged:(id)sender
{
    
    UIDatePicker* picker = (UIDatePicker*)sender;
    NSDateFormatter* df = [[NSDateFormatter alloc] init];
    [df setDateFormat:@"MM-dd "];
    
    
    
    
    if ([BirthDateTextFied isFirstResponder])
    {
        BirthDateTextFied.text = [NSString stringWithFormat:@"%@", [df stringFromDate:picker.date]];
        
        
        //        NSString* string2 = BirthDateTextFied.text;
        //        NSDateFormatter *dateFormatter2 = [[NSDateFormatter alloc] init];
        //        [dateFormatter2 setDateFormat: @"yyyy-MM-dd "];
        //        NSDate *destDate2= [dateFormatter2 dateFromString:string2];
        //        NSTimeInterval  timeInterval2 = [destDate2 timeIntervalSinceDate:[NSDate date]];
        //        //        NSLog(@"%f",timeInterval2);
        //
        //
        //
        //        time1=timeInterval2;
        //        if (time1<0 ) {
        //            BirthDateTextFied.text=nil;
        //            [self showAlertMessage:@"提料日期必须在第2天至第10天区间"];
        //        }
        //
        //        if (time1>864000 ) {
        //            BirthDateTextFied.text=nil;
        //            [self showAlertMessage:@"提料日期必须在第2天至第10天区间"];
        //        }
        
    }
    
    
    
    
    
    //    if ([gjzFied.text length] >0&&[Salary1.text length] >0&&[zbsTextFied1.text length] >0)
    //    {
    //        [buyBtn removeFromSuperview];
    //
    //        buyBtn=[[UIButton alloc]initWithFrame:CGRectMake(0, ScreenHeight-110, ScreenWidth, 50)];
    //        [buyBtn setTitle:@"下一步" forState:UIControlStateNormal];
    //        [buyBtn setTitleColor:titleColor forState:UIControlStateNormal];
    //        buyBtn.titleLabel.font=[UIFont boldSystemFontOfSize:20];
    //        [buyBtn.layer setCornerRadius:0];
    //        [buyBtn.layer setBorderWidth:0.5];
    //        CGColorSpaceRef colorbuyBtn = CGColorSpaceCreateDeviceRGB();
    //        CGColorRef colorrebuy= CGColorCreate(colorbuyBtn,(CGFloat[]){204.0/255.0, 153.0/255.0, 51.0/255.0, 1.0 });
    //        [buyBtn.layer setBorderColor:colorrebuy];//边框颜色
    //        [buyBtn addTarget:self action:@selector(tureBtn:) forControlEvents:UIControlEventTouchUpInside];
    //        buyBtn.alpha=0.9;
    //        [self.view addSubview:buyBtn];
    //
    //
    //    }
    
}

- (void)showAlertWait
{
    alt = [[UIAlertView alloc] initWithTitle:@"网络不稳定 ！" message:@"请确认网络" delegate:self cancelButtonTitle:nil otherButtonTitles: nil];
    [alt show];
    
    [self performSelector:@selector(hideAlert) withObject:nil afterDelay:1.0f];
    
}

- (void)showAlertMessage:(NSString *)msg

{
    alt = [[UIAlertView alloc] initWithTitle:@"温馨提示" message:msg delegate:nil cancelButtonTitle:nil otherButtonTitles: nil];
    [alt show];
    
    [self performSelector:@selector(hideAlert) withObject:nil afterDelay:1.0f];
}
- (void)hideAlert
{
    if (alt != nil)
    {
        [alt dismissWithClickedButtonIndex:0 animated:YES];
        alt = nil;
    }
}
//回收dang键盘

- (void)textFieldDidBeginEditing:(UITextField *)textField{
    [self cancelLocatePicker];
    if (textField.tag == 5)
    { [UIView setAnimationCurve:UIViewAnimationCurveEaseOut];
        myscrollView .frame =CGRectMake(0, -50, ScreenWidth, ScreenHeight);
        [UIView commitAnimations];
        
        
    }
    
}
- (BOOL)textViewShouldBeginEditing:(UITextView *)textView{
    
    [UIView setAnimationCurve:UIViewAnimationCurveEaseOut];
    myscrollView .frame =CGRectMake(0, -250, ScreenWidth, ScreenHeight);
    [UIView commitAnimations];
    
    
    
    return self;
}


-(void)OnTapDone{
    
    [tv resignFirstResponder];
    [PhoneTextFied resignFirstResponder];
    [UserNameTextFied resignFirstResponder];
    [AddressTextFied resignFirstResponder];
    
     [WeChatIdTextFied resignFirstResponder];
    [UIView setAnimationCurve:UIViewAnimationCurveEaseOut];
    myscrollView .frame =CGRectMake(0, 0, ScreenWidth, ScreenHeight);
    [UIView commitAnimations];
    [self cancelLocatePicker];
    
    
}

-(void)closeKeyBoad
{
    
    [tv resignFirstResponder];
    [PhoneTextFied resignFirstResponder];
    [UserNameTextFied resignFirstResponder];
    [AddressTextFied resignFirstResponder];
    [WeChatIdTextFied resignFirstResponder];
    [UIView setAnimationCurve:UIViewAnimationCurveEaseOut];
    myscrollView .frame =CGRectMake(0,0, ScreenWidth, ScreenHeight);
    [UIView commitAnimations];
    [self cancelLocatePicker];
    
}

/*
 #pragma mark - Navigation
 
 // In a storyboard-based application, you will often want to do a little preparation before navigation
 - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
 // Get the new view controller using [segue destinationViewController].
 // Pass the selected object to the new view controller.
 }
 */

@end
